home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
406_01
/
atoc
/
labels.c
< prev
next >
Wrap
Text File
|
1993-11-09
|
1KB
|
47 lines
/*=========================================================================
ATOC labels module
=========================================================================*/
#include <stdio.h>
#include <ctype.h>
#include "atoc.h"
/*-------------------------------------------------------------------------
labels( s ) searches for goto labels, and makes sure they carry a statement
on the same line.
-------------------------------------------------------------------------*/
labels( s )
char *s;
{
char *cp, *strchr();
if ( strchr( s, ':' ) != NULL )
{
/* find first non-whitespace character on line */
for ( cp = s; *cp && isspace( *cp ); ++cp )
;
if ( isid( *cp ) )
if ( strncmp( cp, "default", 7 ) != 0 )
{
/* bypass possible label */
for ( ; *cp && isid( *cp ); ++cp )
;
/* bypass possible whitespace after label */
for ( ; *cp && isspace( *cp ); ++cp )
;
/* MUST be colon - can't be another identifier, etc. */
if ( *cp == ':' )
{
for ( ++cp; *cp; ++cp )
if ( ! isspace( *cp ) )
return;
strcat( s, " ;" ); /* make null statement */
}
}
}
}
/*=======================================================================*/